home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
pasprog.EXE
/
DISKINFO.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-12-05
|
7KB
|
169 lines
ERKAN KAYA
Program Diskinformations;
uses crt;
Type s80=string[80];
var
c : array[1..512] of char;
i : integer;
ch : char;
drive : byte;
hex1,hex2,hex3,hex4,fatid:char;
Procedure DiskRead(Var c;Surucu:byte;SecterNo:integer);
begin inline($1e/$55/$c5/$9e/c/$8a/$46/$06/$8b/$56/$04/$b9/$01/$00/$cd/$25/$9d/$5d/$1f);end;
Function DiskSize(PDrive:byte):integer;
begin inline($b4/$36/$8a/$56/$04/$cd/$21/$f7/$e2/$f7/$e1/$bb/$00/$04/$f7/$f3/$89/$46/$06);end;
Function Drives:byte;
begin inline($cd/$11/$c6/$46/$04/$00/$d0/$e8/$73/$09/$b1/$05/$d2/$e8/$fe/$c0/$88/$46/$04);end;
Function Des(hexa : char):byte;
begin des:=0;
case hexa of
'0': des:=0; '1': des:=1; '2': des:=2; '3': des:=3;
'4': des:=4; '5': des:=5; '6': des:=6; '7': des:=7;
'8': des:=8; '9': des:=9;
'A','a': des:=10; 'B','b': des:=11; 'C','c': des:=12;
'D','d': des:=13; 'E','e': des:=14; 'F','f': des:=15;
end;
end;
Function Hex(deca : byte):char;
begin hex:='0';
case deca of
0: hex:='0'; 1: hex:='1'; 2: hex:='2'; 3: hex:='3';
4: hex:='4'; 5: hex:='5'; 6: hex:='6'; 7: hex:='7';
8: hex:='8'; 9: hex:='9';
10: hex:='A'; 11: hex:='B'; 12: hex:='C';
13: hex:='D'; 14: hex:='E'; 15: hex:='F';
end;
end;
Procedure Hexs(c1,c2 : char;var hex1,hex2,hex3,hex4:char);
begin
hex1:=hex(Ord(c2)div 16);
hex2:=hex(Ord(c2)-(Ord(c2)div 16)*16);
hex3:=hex(Ord(c1)div 16);
hex4:=hex(Ord(c1)-(Ord(c1)div 16)*16);
end;
Procedure ConV(c1,c2 : char;var i:integer); var hex1,hex2,hex3,hex4:char;
begin i:=0;
Hexs(c1,c2,hex1,hex2,hex3,hex4);
i:=(des(hex1)*4096)+(des(hex2)*256)+(des(hex3)*16)+(des(hex4))
end;
Procedure Cizgi(kod:char);var say:integer;
begin for say:=1 to 80 do Write(kod);end;
Procedure Beep; begin Sound(220);Delay(2);NoSound;end;
Procedure SatirSil(n:byte); var say:byte;
begin TextColor(7);TextBackground(0);For say:=1 to n do DelLine;end;
Procedure DiskInfo;
var
f1,f2,f3,f4,f5,s1,s2,i,say : integer;
r,cluster : real;
DriveName : char;
DiskArea : integer;
DisketType: string[80];
sat,sut : byte;
begin
TextColor(15);TextBackground(1);clrscr;
Drive:=0; DiskArea:=0; cluster:=0.0;f1:=0;f2:=0;f3:=0;f4:=0;f5:=0;s1:=0;s2:=0;
Writeln;cizgi(#205);
Write(' ························ Disk ÿnformation Utility····························· ');
cizgi(#205);cizgi(#196);
Write(' Sürücü : '); sut:=whereX;sat:=whereY;
Writeln;cizgi(#196);
Repeat
GotoXY(sut,Sat);driveName:=ReadKey;
DriveName:=UpCase(DriveName);Writeln(DriveNAme);
Until DriveName in ['A'..'E','Q',#27]; if DriveName=#27 then DriveName:='Q';
Writeln;Writeln;
Case DriveName of
'A' : Drive:=0;
'B' : Drive:=1;
'C' : Drive:=2;
'D' : Drive:=3;
'E' : Drive:=4;
'Q' : begin beep;Writeln;Writeln(' ÿƒlem iptal edildi !'+#13);
cizgi(#196);cizgi(#205);SatirSil(11);Exit;
end;
end;{Case}
cizgi(#205);
if Drive>Drives then Begin Beep;Writeln;Writeln(' Geçersiz Sürücü ! ÿƒlem iptal edildi');
cizgi(#196);cizgi(#205);SatirSil(11);Exit;
end;
{$i-}
for say:=1 to 512 do c[say]:=#00;
DiskRead(c,drive,0);
DiskArea:=DiskSize(drive+1);
{$i+}
if (c[1]=#00)or(ioresult<>0)then begin Writeln;Writeln(' Diskten Boot okunamadì...');beep;
cizgi(#196);cizgi(#205);SatirSil(9);Exit;
end;
if C[1]<>#235 then begin Writeln;Writeln(' Boot Sectör Bozuk...');beep;
cizgi(#196);cizgi(#205);SatirSil(9);Exit;
end;
Case c[13] of #0 : i:=128;#1 : i:=256;#2 : i:=512;#3 : i:=1024;end;
GotoXY(1,10);
Hexs(c[2],c[3],hex1,hex2,hex3,hex4);
Writeln(' Boot Jump : ',hex3,hex4,' hex ');
Writeln(' Format iƒareti : ',c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11]);
Writeln(' Sectör Bilgi Alanì : ',i,' byte');
f1:=i;
Writeln(' CLuster : ',ord(c[14]),' sectör');
Writeln(' Fat Sayìsì : ',ord(c[17]));
f2:=i;f3:=ord(c[17]);
Writeln(' Root Alanì : ',i,' dosya ');
f4:=i;
Hexs(c[20],c[21],hex1,hex2,hex3,hex4);
i:=(des(hex1)*4096)+(des(hex2)*256)+(des(hex3)*16)+(des(hex4));
r:=(des(hex1)*4096.0)+(des(hex2)*256.0)+(des(hex3)*16.0)+(des(hex4));
GotoXY(40,11);Writeln(' Media descriptör : ',hex1,hex2,' hex');
Conv(c[23],c[24],i);GotoXY(40,12);Writeln(' FAT`ìn sectör sayìsì : ',i);
f5:=i;
Conv(c[25],c[26],i);GotoXY(40,13);Writeln(' Tracktaki sectör sayìsì : ',i);
Conv(c[27],c[28],i);GotoXY(40,14);Writeln(' Yüzey sayìsì : ',i);
Conv(c[29],c[30],i);GotoXY(40,15);Writeln(' Saklì sectör sayìsì : ',i);
cizgi(#196);s1:=f3*f5;
if (s1>10000)or(f1>1024) then s2:=0 else s2:=((f4*32)div f1)+s1;
Writeln(' Boot : ',(f2-1),' sectör');
Writeln(' FAT : ',f2,'-',s1,' sectör');
Writeln(' Root : ',(s1+1),'-',(r-1.0):6:0,' sectör');
DisketType:='tanìmsìz';
if (diskArea>1500)and(drive>1) then DisketType:='HardDisk';
Case DiskArea of
354 : DisketType:='360 kb. 5"` 40 track / 9 sector ';
713 : DisketType:='720 kb. 3"` 80 track / 9 sector ';
1185 : DisketType:='1.2 Mb. 5"` 80 track / 15 sector ';
1423 : DisketType:='1.44 Mb. 3"` 80 track / 18 sector ';
end;{Case diskArea}
Writeln(' Disk tipi : ',DisketType);
GotoXY(40,17);Writeln(' Data alanì : ',diskArea:6,' kb.');
cluster:=(r-(s2+1))/ord(c[14]);
GotoXY(40,18);Writeln(' Cluster sayìsì : ',cluster:6:0,' kb.');
if c[2]>#60 then begin
Hexs(c[42],c[43],hex1,hex2,hex3,hex4);
gotoXY(40,19);Write(' Disk Seri No : ');
Write(hex1,hex2,hex3,hex4,'-');
Hexs(c[40],c[41],hex1,hex2,hex3,hex4);
Write(hex1,hex2,hex3,hex4);
gotoXY(40,20);Write(' Disk Etiketi : ');
for say:=44 to 54 do write(c[say]);
end;{if}
writeln;Writeln;
cizgi(#205);TextColor(7);TextBackground(0);
end;{Disk info}
{Ana Program}
Begin
Diskinfo;
Satirsil(1);
Readkey;
end.